/*
 * @Author: pengtianrui 2276608413@qq.com
 * @Date: 2024-07-19 14:42:56
 * @LastEditors: 武兴创 superjava@vip.qq.com
 * @LastEditTime: 2024-08-28 17:03:05
 * @FilePath: \SGFEM\DataStructure\FEM\Material\include\Anisotropic3DMaterial.h
 * @Description: 三维维线弹性各项异性材料
 * * 21 个独立的弹性常数, 弹性常数只使用上三角部分
 * MAT9
 */
#pragma once
#include "Utility/Algebra/Matrix.h"

#include "DataStructure/Common/DataStructureNamespace.h"
#include "DataStructure/Common/Id.h"
#include "DataStructure/Common/Real.h"
#include "DataStructure/Input/Material/MaterialBase.h"

#include "MaterialTypes.h"

SG_DATASTRUCTURE_FEM_NAMESPACE_OPEN
struct DECLSPEC Anisotropic3DMaterial : public MaterialBase
{
    /// @brief 构造函数，创建3维各项异性材料
    /// @param id 材料属性号，默认0
    // Anisotropic3DMaterial (SG::DataStructure::Common::Id id = 0);
    SG::DataStructure::Common::Real m_G[21]    = { 0.0 };  ///< 弹性常数
    SG::DataStructure::Common::Real m_rho      = 0.0;      ///< 密度
    SG::DataStructure::Common::Real m_Ai[6]    = { 0.0 };  ///< x/1方向热膨胀系数
    SG::DataStructure::Common::Real m_tref     = 0.0;      ///< 参考温度
    SG::DataStructure::Common::Real m_ge       = 0.0;      ///< 单元阻尼系数
    SG::DataStructure::Common::Real m_GE[21]   = { 0.0 };  ///< 阻尼矩阵
    SG::DataStructure::Common::Id   m_domainId = 0;

    static MaterialTypes GetType ()
    {
        return MaterialTypes::MATTYPE_3DAnisotropic;
    };

    bool useGEMatrix ()
    {
        for (const double& i : m_GE)  // NOLINT(readability-use-anyofallof)
        {
            if (i != 0.0)
            {
                return true;
            }
        }
        return false;
    }

    /// @brief 获取材料 6*6 矩阵
    SG::Algebra::Matrix GetD () const;
};
DECLSPEC bool operator== (const Anisotropic3DMaterial& a, const Anisotropic3DMaterial& b);

SG_DATASTRUCTURE_FEM_NAMESPACE_CLOSE